<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">

//初始化表单验证
$("#editForm").validate({ 
	rules:{
		time_line:{
			maxlength:20
		},
		state:{
			range:[0,1]
		}
	},
	messages:{
		time_line: {required: "请输入秒杀时间段名称"},
		begin: {required: "请输入开始时间"},
		end: {required: "请输入结束时间"}
		
	},
	submitHandler:function(form){
		$(form).ajaxSubmit({
			success:function(data){
				switch (data.flag) {
				case -1:
					Kit.alert("网络繁忙...，请重试");
					return;
				case 1:{
					Kit.alert("时间段描述不能为空");
					return;
					
				}
				case 2:{
					Kit.alert("时间段描述长度不能超过20");
					return;
				}
				case 3:{
					Kit.alert("开始时间不能为空");
					return;
				}
				case 4:{
					Kit.alert("结束时间不能为空");
				}
				case 0:
					dataPaginator.loadPage(1);
					editDialog.close();
				}
			}
		});
	}
});


</script>
<form id="editForm" action="${BASE_PATH}/spike/time/doEdit"
	method="post" class="form-horizontal">
	<div class="form-group">
		<label class="col-lg-2 control-label">秒杀时间段名称</label>
		<div class="col-lg-9">
			<input type="text" name="time_line" value="${object.time_line}"
				class="form-control" placeholder="请输入秒杀时间段名称" required
				maxlength="50">
		</div>
	</div>
	<div class="form-group">
		<label class="col-lg-2 control-label">每日开始时间</label>
		<div class="col-lg-9">
			<input type="time" name="begin" value="${object.begin}"
				class="form-control search-input width120 datetimepicker"
				data-format="hh:ii:ss" maxlength="8">

		</div>
	</div>
	
	<div class="form-group">
		<label class="col-lg-2 control-label">每日结束时间</label>
		<div class="col-lg-9">
			<input type="time" name="end" value="${object.end }"
				class="form-control search-input width120 datetimepicker"
				data-format="hh:ii:ss" maxlength="8">
		</div>
	</div>
	<div class="form-group">
		<label class="col-lg-2 control-label">是否启用</label>
		<div class="col-lg-9">
		
			<select name="state" class="selectpicker form-control">
				<option value="1"
					<c:if test="${object.state==1}">data-dropdown-selected="true"</c:if>>启用</option>
				<option value="0" <c:if test="${object.state==0}">selected</c:if>>禁用</option>
			</select>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-6">
			<button class="btn btn-primary col-sm-3 pull-right" type="submit"
				autocomplete="off">提交</button>
		</div>
		<div class="col-lg-6">
			<button class="btn btn-default col-sm-3 pull-left" type="button"
				onclick="javascript:editDialog.close();" autocomplete="off">取消</button>
		</div>
	</div>
	<input type="hidden" name="id" value="${object.id}"/>
</form>

<!-- <script type="text/javascript">
$("#sEndDate").datetimepicker({
		    format: 'yyyy-mm-dd hh:ii:ss',
		    minuteStep:1,
		    minView:'hour',
		    language: 'zh-CN',
		    autoclose:true,
			}).on("click",function(){
				var d=$("#sBeginDate").val();
				var d1=new Date(d); 
				d1.setDate(d1.getDate()+1); 
				$("#sEndDate").datetimepicker("setStartDate",d1);
			}); </script>
 -->

